package com.lecloud.util;

import java.util.Map;
import java.util.TreeMap;

import cn.edu.live.util.EncryptUtil;

import com.lecloud.constant.Const;

/**
 * 用于获得sign
 * 
 * @author zhagz
 * 
 */
public class LeCloudVerify {

	public static String getSign(Map<String, String> map) {
		return getSign(Const.secretKey, map);
	}

	public static String getSign(String secretkey, Map<String, String> map) {

		String param = "";

		TreeMap<String, String> treeMap = new TreeMap<>(map);

		for (Map.Entry<String, String> entry : treeMap.entrySet()) {
			param += entry.getKey() + entry.getValue();
			// System.out.println(entry.getKey() + ":" + entry.getValue());
		}
		param += secretkey;

		// System.out.println("param=" + param);
		// sign
		return EncryptUtil.MD5(param);
	}
}
